// testConnection.js
const { Sequelize } = require('sequelize');

// 初始化 Sequelize，连接 SQLite 数据库
const sequelize = new Sequelize({
    dialect: 'sqlite',
    storage: './database/database.sqlite' // 指定 SQLite 数据库文件路径
});

async function testConnection() {
    try {
        // 测试数据库连接
        await sequelize.authenticate();
        console.log('Connection has been established successfully.');
    } catch (error) {
        console.error('Unable to connect to the database:', error);
    } finally {
        await sequelize.close(); // 关闭数据库连接
    }
}

// 执行测试连接
testConnection();
